#ifndef REGISTERDEF_H
#define REGISTERDEF_H

#include <QtCore>

enum RegisterType {
    REG_STRING,
    REG_FLOAT,
    REG_INTEGER,
    REG_UNKNOWN
};

enum RegisterFlags {
    FLAG_NONE = 0x00,
    FLAG_FLOAT = 0x01,
    FLAG_INTEGER = 0x02,
    FLAG_STRING = 0x04,
    FLAG_HIDDEN = 0x08,
    FLAG_READ = 0x10,        // used by PC interface
    FLAG_WRITE = 0x20,        // used by PC interface
    FLAG_CAN_BE_LOGGED = 0x40,
    FLAG_SYSTEM = 0x80
};

class RegisterDef
{
public:
    RegisterDef();
    RegisterDef( const RegisterDef &other );

    RegisterDef( int address );
    RegisterDef( QString name );
    RegisterDef( QString name, int address, int flags );
    ~RegisterDef();

    QString name() const;
    int flags() const;
    int address() const;
    float fValue() const;
    int iValue() const;
    QString sValue() const;

    void setValue(QString value);
    QString getValue() const;
    double getfValue() const;

    RegisterType regtype() const;
    bool loggable() const;
    bool readable() const;
    bool writeable() const;
    bool hidden() const;
    bool system() const;

    bool operator==( const RegisterDef &other ) const;

private:
    QString m_name;
    int m_address;
    int m_flags;
    float m_fValue;
    int m_iValue;
    QString m_sValue;
};

Q_DECLARE_METATYPE(RegisterDef);

#endif // REGISTERDEF_H
